<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>登录</title>
	<link rel="stylesheet" type="text/css" href="../static/admin/css/index.css" />
	<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>

<body>

<img class="bgone" src="../static/admin/img/1.jpg" />
<img class="pic" src="../static/admin/img/a.png" />

<div class="table">
	<div class="wel">酒店系统后台登录</div>
	<div class="wel1">JIU DIAN XI TONG HOU TAI DENG LU</div>
	<div class="user">
		<div style=""><img src="../static/admin/img/yhm.png" /></div>
		<input type="text" id="username" name="username" placeholder="用户名" />
	</div>			
	<div class="password">
		<div><img src="../static/admin/img/mm.png" /></div>
		<input type="password" id="password" name="password" placeholder="密码"/>
	</div>
	<input class="btn" type="button" name="登录" value="登录" onclick="login()"/>
</div>
<script>
	function login() {
		$.ajax({
			url:"/admin/login",
			dataType:"json",
			type:"post",
			data:{
				username:$("#username").val(),
				password:$("#password").val()
			},
			success:function (data) {
				alert(data.message);
				if (parseInt(data.code)==200){
					location.href="/view/admin-index"
				}
			},
			error:function () {
				alert("后台登录请求出错")
			}
		})
	}
</script>
</body>
</html>